package scanpackage.jmsbean;

import org.apache.activemq.ActiveMQConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.listener.SimpleMessageListenerContainer;

import javax.jms.ConnectionFactory;
@Configuration
public class JMSConfig {

    private ActiveMQConnectionFactory activeMQConnectionFactory;
    @Bean
    @DependsOn("jmsTemplate")
    public ActiveMQConnectionFactory activeMQConnectionFactory()
    {
        return activeMQConnectionFactory;
    }

    @Bean
    public JmsTemplate jmsTemplate()
    {
        activeMQConnectionFactory=new ActiveMQConnectionFactory("tcp://172.16.0.11:61616");
        return new JmsTemplate(activeMQConnectionFactory);
    }


}

